<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
    <!-- 
        本章内容主要讲解Vue实例的操作
     -->
</head>
<body>
    <div id="root">
        测试
    </div>
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    content: 1
                }
            },
            // 测试一个函数mounted,表示页面加载完成,才会执行该函数
            mounted() {
                console.log('页面加载完成,自动执行mounted函数');
                setInterval(() => {
                    this.content+=1;
                }, 1000);
            },
            template: `<div>{{content}}</div>`
        }).mount("#root");
    </script>
</body>
</html>